home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 8: LINUX Games
/
Linux Cubed Series 8 - LINUX Games.iso
/
games
/
x11
/
networke
/
civ-0.000
/
civ-0
/
civ-0.3
/
src
/
main.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1996-03-04
|
2KB
|
82 lines
#define VERSION "0.3"
#include "net.h"
#include "debug.h"
#include "display.h"
class Graphics;
Graphics *screen;
int numPlayers;
char *myName;
char *serverName; // only used in windows
#ifdef FOR_X11
#include "X11Screen.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
void optionhelp();
main(int argc, char **argv)
{
extern char WorldCreate;
extern int distanceBetweenConts, contChunkSize;
extern int numberOfChunksPerCont;
numPlayers = 0;
myName = NULL;
opterr = 0;
int opt;
while ((opt = getopt(argc, argv, "h?sWd:w:")) != -1) {
if ((opt == 'h') || (opt == '?')) optionhelp();
if (opt == 'd') debugFlags = optarg;
if (opt == 'w') {
distanceBetweenConts = atoi(optarg);
contChunkSize = atoi(argv[optind++]);
numberOfChunksPerCont = atoi(argv[optind++]);
printf("dist %d, chunk size %d, number of chunks %d\n",
distanceBetweenConts,
contChunkSize, numberOfChunksPerCont);
}
if (opt == 's') WorldCreate = WorldCreate | 0x02;
}
screen = new X11Screen(argc, argv, HandleKey);
return screen->MainLoop();
}
void optionhelp()
{
printf("Multiplayer Civ v%s\n\n",VERSION);
printf("Usage: civ [-s] [-d flags] [-w distance size number]\n\n");
printf(" -d sets the debuging flags (cFinprsuw or +)\n");
printf(" -s sets the whole world visable\n");
printf(" -w sets the distance between continents, the size of a chunk\n");
printf(" and the number of chunks per continent\n");
exit(0);
}
#else
#include <fcntl.h>
#include <stdlib.h>
#include "WScreen.h"
#include "server.h"
#include "defs.h"
int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine,
int nCmdShow)
{
_fmode = O_BINARY;
// registers class, displays civ window, asks for default server,
// player name and num players
screen = new WScreen(HandleKey, hInstance, hPrevInstance, nCmdShow);
CivInit(savedGame ? RestoreSaveFile : StartNewGame, serverName);
return screen->MainLoop();
}
#endif